<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>demo</title>
  </head>
  <body>
    <div id="root"></div>
    <script src="./ofa.js"></script>
    <script type="module" src="./web.js"></script>
    <template page>
      <div>I am singlePage page {{num}}</div>
      <button on:click="addOne">Add One</button>
      <br />
      <button on:click="addNum({num:10})">Add Ten</button>
      <div data-testid="que">{{query}}</div>
      <button on:click="back()" data-testid="back">Back</button>
      <h4>page1 html ⬇️</h4>
      <div data-testid="page1">{{page1}}</div>
    
      <script>
        export default async function ({ load, query }) {
          const page1 = await load("./page1.html");
    
          return {
            data: {
              num: 1,
              page1,
              query,
            },
            proto: {
              addOne() {
                console.log("addOne start => ", this.num);
                this.num++;
                console.log("addOne end => ", this.num);
              },
              addNum(obj) {
                console.log("addNum start => ", this.num);
                this.num += obj.num;
                console.log("addNum end => ", this.num);
              },
            },
          };
        }
      </script>
    </template>
  </body>
</html>